from selenium import webdriver;
from lxml import etree;
import time;

# 实例化一个浏览器对象，入参未驱动得路径
bro = webdriver.Chrome(executable_path="./chromedriver.exe");
# 发送请求
bro.get("http://news.baidu.com/guoji/");
# 获取页面源码数据
page_text = bro.page_source;
# 解析数据
html = etree.HTML(page_text);
lis = html.xpath("//*[@id='col_focus']/div[1]/div[2]/ul[1]/li");

for li in lis:
    title = li.xpath("./a/text()")[0];
    print("tile",title)
time.sleep(5);

# 关闭浏览器
bro.quit();
